<template>
	<view class="content">
		<!-- 设置中心 列表 -->
		<view class="set_list">
			<navigator class="set_item" url="../modifyPhone/modifyPhone">
				<image :src="imgUrl+'/static/wap/infoImg/set_one@2x.png'" class="set_item_img"></image>
				<text class="set_item_txt">手机号</text>
				<image :src="imgUrl+'/static/wap/infoImg/set_arrow@2x.png'" class="set_item_arr"></image>
			</navigator>
			
			<navigator class="set_item" url="../modifyPass/modifyPass">
				<image :src="imgUrl+'/static/wap/infoImg/set_two@2x.png'" class="set_item_img"></image>
				<text class="set_item_txt">修改密码</text>
				<image :src="imgUrl+'/static/wap/infoImg/set_arrow@2x.png'" class="set_item_arr"></image>
			</navigator>
			
			<navigator class="set_item" url="../aboutUs/aboutUs">
				<image :src="imgUrl+'/static/wap/infoImg/set_three@2x.png'" class="set_item_img"></image>
				<text class="set_item_txt">关于我们</text>
				<image :src="imgUrl+'/static/wap/infoImg/set_arrow@2x.png'" class="set_item_arr"></image>
			</navigator>
			
			<navigator class="set_item" url="../userAgr/userAgr">
				<image :src="imgUrl+'/static/wap/infoImg/set_four@2x.png'" class="set_item_img"></image>
				<text class="set_item_txt">用户协议</text>
				<image :src="imgUrl+'/static/wap/infoImg/set_arrow@2x.png'" class="set_item_arr"></image>
			</navigator>
			
			<navigator class="set_item" @click="logout">
				<image :src="imgUrl+'/static/wap/infoImg/set_five@2x.png'" class="set_item_img"></image>
				<text class="set_item_txt">退出登录</text> 
			</navigator> 
		</view>
	</view>
</template>

<script>
	import util from '../../static/util.js'
	export default {
		data() {
			return {
				imgUrl:util.globalData.imgPre,
			};
		},
		onLoad() {
		  
		 
		},
		methods:{
			logout(){
				var that=this;
				uni.showModal({
				    title: '提示',
				    content: '确定退出登陆',
				    success: function (res) {
				        if (res.confirm) {
				            console.log('用户点击确定');
							that.ajax({
								url:'api/user/logout',
								success:function(res){
									console.log(res)
									if(res.code==200){
										uni.showToast({
											title:"退出成功",
											icon:'none'
										});
										uni.removeStorage({
										    key: 'token',
										    success: function (res) {
										       // console.log('success');
										    }
										});
										uni.removeStorage({
										    key: 'userInfo',
										    success: function (res) {
										       // console.log('success');
										    }
										});
										setTimeout(() => {
											uni.switchTab({
												url:'../index/index'
											}) 
										}, 1000)
										
									}else{
										uni.showToast({
											title:"" + res.msg,
											icon:'none'
										});
									}
									
								}
							  })
				        } else if (res.cancel) {
				            console.log('用户点击取消');
				        }
				    }
				});

			}
		}
	}
</script>

<style lang="less" scoped>
	.content{
		overflow: hidden;
		color: #333;
		background-color: #F7F9FB;
		height: 100vh;
	}
	.set_list{
		.set_item{
			display: flex;
			padding: 0 30rpx;
			margin-top: 18rpx;
			height: 120rpx;
			line-height: 120rpx;
			font-size: 30rpx;
			background-color: #fff;
			.set_item_img {
				margin: auto 0;
				margin-right: 39rpx;
				width: 44rpx;
				height: 44rpx;
			}
			.set_item_txt {
				flex: 1;
			}
			.set_item_arr {
				margin:  auto 0;
				width: 25rpx;
				height: 25rpx;
			}
		}
	}
</style>
